//
//  DGPBaseRequest.swift
//  DragonPlatform
//
//  Created by JF.Zhan on 2017/9/27.
//  Copyright © 2017年 JF.Zhan. All rights reserved.
//

import UIKit

class DGPBaseRequest: NSObject {

    var parameters = [String : Any]()
    
    var url        = String()
    
    var dataImage  = UIImage()
    
    var needLoading = Bool()
    
    func addRequest(finished:@escaping NetworkFinihsed) {
    
        NetWorkTools.shareNetworkTool().post(url, parameters: parameters, needLoading: needLoading, finished: finished)
        
    }
    
    func getRequest(finished:@escaping NetworkFinihsed) {
    
        NetWorkTools.shareNetworkTool().get(url, parameters: parameters, needLoading: needLoading, finished: finished)
    }
    
    func uploadRequest(finished:@escaping NetworkFinihsed) {
    
        NetWorkTools.shareNetworkTool().upload(url, image: dataImage, parameters: parameters, needLoading: false, finished: finished)
    }
    
    func uploadCredentialsRequest(finished:@escaping NetworkFinihsed) {
        
        NetWorkTools.shareNetworkTool().uploadCredentials(url, image: dataImage, parameters: parameters, needLoading: needLoading, finished: finished)
    }
}
